from PySide2.QtWidgets import QDialog,QWidget
from PySide2.QtCore import Qt,Signal,QPoint
from PySide2.QtGui import QMouseEvent,QKeyEvent

class ClickPosi(QDialog):

    SigPosi = Signal(QPoint)

    def __init__(self, parent: QWidget = None, f: Qt.WindowFlags = Qt.WindowFlags()) -> None:
        super().__init__(parent, f)

        self.setWindowOpacity(0.1)
        self.activateWindow()
        self.setWindowFlag(Qt.WindowType.WindowStaysOnTopHint)
        self.setWindowState(Qt.WindowState.WindowFullScreen)
        self.setFocus()

    def mousePressEvent(self, event: QMouseEvent) -> None:

        self.SigPosi.emit(event.pos())
        self.accept()
        event.accept()
    
    def keyPressEvent(self, arg__1: QKeyEvent) -> None:
        
        print(2)
        if arg__1.matches(Qt.Key_Exit):
            print(1)
            arg__1.accept()
            self.accept()